// Basic vertex shader
// Can be used in all shading models

uniform vec3 fvEyePosition;

varying vec2 Texcoord;
varying vec3 ViewDirection;
varying vec3 Tangent;
varying vec3 Binormal;
varying vec3 Normal;
   
attribute vec3 rm_Binormal;
attribute vec3 rm_Tangent;
   
void main( void )
{
   gl_Position = ftransform();
   Texcoord    = gl_MultiTexCoord0.xy;
    
   vec4 fvObjectPosition = gl_ModelViewMatrix * gl_Vertex;
   
   ViewDirection  = fvEyePosition - fvObjectPosition.xyz;
     
   vec3 fvNormal         = gl_NormalMatrix * gl_Normal;
   vec3 fvBinormal       = gl_NormalMatrix * rm_Binormal;
   vec3 fvTangent        = gl_NormalMatrix * rm_Tangent;
  
   ViewDirection.x  = dot( fvTangent, ViewDirectionO );
   ViewDirection.y  = dot( fvBinormal, ViewDirectionO );
   ViewDirection.z  = dot( fvNormal, ViewDirectionO );
  
   Tangent      = fvTangent;
   Binormal     = fvBinormal;
   Normal       = fvNormal;
   Normal.z     = -Normal.z;
}
